home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr48 / ppascal.zip / SPIRAL1.PAS < prev    next >
Pascal/Delphi Source File  |  1993-04-24  |  1KB  |  40 lines

  1. program spiral;
  2. uses
  3.   crt,graph;
  4. const
  5.   TotalDiam = 9000;   { final diameter of the spiral }
  6.   LineDist = 20;      {  distance between the lines  }
  7.   width = 1;           { line width: 1=narrow, 3=wide }
  8.   x = 320;
  9.   y = 240;
  10. var
  11.   Gd, Gm           : Integer;
  12.   radius, angle, z : integer;
  13.   ch               : char;
  14. begin
  15.   randomize;
  16.   Gd := Detect; InitGraph(Gd, Gm, 'c:\utils\tp');
  17.   if GraphResult <> grOk then Halt(1);
  18.   radius:=1;
  19.   angle:=0;
  20.   setcolor(random(getmaxcolor-1)+1);
  21.   setlinestyle(0,0,width);
  22.   for z:= 1 to TotalDiam do
  23.     begin
  24.       { setcolor ( random ( getmaxcolor ) +1 ); }
  25.       arc ( x, y, angle, angle + 1, radius );
  26.       inc ( angle );
  27.       if z mod linedist = 0 then inc ( radius, 1 );
  28.       if angle=360 then angle:=0;
  29.       if keypressed then
  30.         begin
  31.           ch := readkey;
  32.           ch := readkey;
  33.           closegraph;
  34.           halt(1);
  35.         end;
  36.     end;
  37.   ch := readkey;
  38.   closegraph;
  39. end.
  40.